const stus = require('./学生数据结构')


//通过id查找
stus.findStudetById(2,(err,data)=>{
    if(err){
        throw err
    }
    console.log(data)
})


//添加
let newStudent={
    neme:'吴浩',
    classID:1,
    age:20,
    gender:1,
    hobbies:'吃,喝,拉,撒,睡',
}
stus.addStudent(JSON.stringify(newStudent),err =>{
    if(err){
        throw err
    }
    console.log('添加成功')
})



//删除
stus.deleteStudentById(6,(err) => {
    if(err){
        throw err
    }
    console.log('删除成功')
})


//修改
let updateStudent = {
    "name": "吴浩",
    "classID": 2,
    "age": 21,
    "gender": 2,
    "hobbies": "吃屎",
    "id":5
}
stus.updataStudent(JSON.stringify(updateStudent),(err)=>{
    if(err){
        throw err
    }
    console.log('修改成功');
})